<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('防雷重点单位列表')" />
	<!--<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
	<link th:href="@{/css/boot.css}" rel="stylesheet" />
	<link th:href="@{/css/city-picker.css}" rel="stylesheet"  />
	<script th:src="@{/js/jquery.m.js}"></script>
	<script th:src="@{/js/boot.js}"></script>
	<script th:src="@{/js/city-picker.data.js}"></script>
	<script th:src="@{/js/city-picker.js}"></script>
	<script th:src="@{/js/main.js}"></script>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-css" />-->
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <link th:href="@{/css/city-picker.css}" rel="stylesheet"  />
    <script th:src="@{/js/city-picker.data.js}"></script>
    <script th:src="@{/js/city-picker.js}"></script>
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	<!--<div class="ui-layout-west">
		<div class="main-content">
			<div class="box box-main">
				<div class="box-header">
					<div class="box-title">
						<i class="fa icon-grid"></i> 地区管理
					</div>
					<div class="box-tools pull-right">
						&lt;!&ndash;<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理地区"><i class="fa fa-edit"></i></a>&ndash;&gt;
						<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>

					</div>
				</div>
				<div class="ui-layout-content">
					<div id="tree" class="ztree"></div>
				</div>
			</div>
		</div>
	</div>-->
     <div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<input type="hidden" id="createId" name="createId">
					<input type="hidden" id="prentId" name="prentId">
					<div class="select-list">
						<ul>
							<li>
								<p>单位名称:</p>
								<input type="text" name="unitName"  />
							</li>
                            <li>
								<p >所属区域:</p>
								<div class="col-sm-8" style="padding: 0">
									<input name="district" id="district" class="form-control" readonly type="text"  data-toggle="city-picker">
								</div>
                            </li>
							<li style="width: 295px">
								<p>行业属性:</p>
								<select name="tradeProperty"  th:with="type=${@dict.getType('t_jc_flzddw')}">
									<option value="">请选择行业属性</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>
							<li>
								<p>防雷类别:</p>
									<select name="thunderCategory" th:with="type=${@dict.getType('t_jc_flzddw_type')}">
										<option value="" th:color="gray">请选择防雷级别</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
									</select>
							</li>

							<li>
								<p>检测周期</p>
								<select>
									<option value="">请选择检测周期</option>
									<option value="0">半年</option>
									<option value="1">一年</option>
								</select>
							</li>

							<li>
								<p>经营状态:</p>
									<select name="manageStaus"  th:with="type=${@dict.getType('t_jc_flzddw_manage')}">
										<option value="">请选择经营状态</option>
										<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
									</select>
							</li>
                            <li>
                                <p>是否违规:</p>
                                <select name="violation"  th:with="type=${@dict.getType('t_jc_flzddw_record')}">
                                    <option value="">是否有违规记录</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm"  id = "reset" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:tJcFlzddw:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:tJcFlzddw:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:tJcFlzddw:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:tJcFlzddw:export">
						<i class="fa fa-download"></i> 批量导出
				 </a>-->
				<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:tJcFlzddw:import">
					<i class="fa fa-upload"></i> 导入
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <script th:inline="javascript">
		var detailFlag = [[${@permission.hasPermi('system:tJcFlzddw:detail')}]];
        var editFlag = [[${@permission.hasPermi('system:tJcFlzddw:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:tJcFlzddw:remove')}]];
		var types = [[${@dict.getType('t_jc_flzddw_type')}]];
		var types1 = [[${@dict.getType('t_jc_flzddw_time')}]];
		var types2 = [[${@dict.getType('t_jc_flzddw_manage')}]];
		var types3 = [[${@dict.getType('t_jc_flzddw')}]];
        var prefix = ctx + "system/tJcFlzddw";

		/*$(function() {
			/!*var panehHidden = false;
			if ($(this).width() < 769) {
				panehHidden = true;
			}
			$('body').layout({ initClosed: panehHidden, west__size: 185 });
			queryDeptTree();
		});*!/*/
        $(function() {

			/*$("#detection_date").datetimepicker({
				format: "yyyy-mm-dd",
				minView: "month",
				autoclose: true
			});*/
            $('#reset').bind('click',function(){
                $('[data-toggle="city-picker"]').citypicker('reset');

            });
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
				importUrl: prefix + "/importData",
				importTemplateUrl: prefix + "/importTemplate",
                detailUrl: prefix + "/detail/{id}",
                modalName: "防雷重点单位",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'thunderUnitId', 
					title : '业务id',
					visible: false
				},
				{
					field : 'unitName',
					title : '单位名称',
					sortable: true
				},


				{
					field : "administrativeRegion",
					title : '所属区域',
                    sortable: true
                    // visible:true
				},
				{
					field : 'creditCode',
					title : '社会统一信用代码',
					sortable: true

				},
				/*
				{
					field : 'emailCode', 
					title : '邮政编码',
					sortable: true
				},
				{
					field : 'longitude', 
					title : '经度',
					sortable: true
				},
				{
					field : 'latitude', 
					title : '纬度',
					sortable: true
				},*/
				{
					field : 'tradeProperty',
					title : '行业属性',
					align: 'center',
					formatter: function (value, row, index) {
						return $.table.selectDictLabel(types3, value);
					}

				},
				{
					field : 'thunderCategory', 
					title : '防雷类别',
					align: 'center',
					formatter: function (value, row, index) {
						return $.table.selectDictLabel(types, value);
					}

				},
				{
					field : 'searchCycle', 
					title : '检测周期',
					align: 'center',
					formatter: function(value, row, index) {
						// return $.table.selectDictLabel(types1, value);
                        if(value == 0){
                            return "半年";
                        }else{
                            return "一年";
                        }
					}
				},
				{
					field : 'unitAddress',
					title : '单位地址',
					sortable: true
				},
					/*
            {
                field : 'reportSatus',
                title : '检测状态',
                sortable: true,
                formatter:function (value, row, index) {
                    if(value == 1){
                        return "否";
                    }else if(value == 2){
                        return "是";
                    }
                }

            },
            {
                field : 'detection_name',
                title : '检测机构',
                visible: true
            },*/
				// {
				// 	field : 'detectionDate',
				// 	title : '检测日期',
				// 	sortable: true
				// },
				/*{
					field : 'detectionYear',
					title : '检测年度',
					sortable: true


				},*/

				{
					field : 'contacts', 
					title : '联系人',
					sortable: true
				},
				{
					field : 'contactsPhone', 
					title : '联系电话',
					sortable: true
				},
				/*{
					field : 'securityPeople', 
					title : '安全负责人',
					sortable: true
				},*/
				/*{
					field : 'securityPeoplePhone', 
					title : '安全负责人联系电话',
					sortable: true
				},*/
				/*{
					field : 'foundDate', 
					title : '成立日期',
					sortable: true
				},*!/*/
				{
					field : 'manageStaus',
					title : '经营状态',
					align: 'center',
					formatter: function (value, row, index) {
						return $.table.selectDictLabel(types2, value);
					}
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
						actions.push('<a class="btn btn-warning btn-xs ' + detailFlag +
								'" href="javascript:void(0)" onclick="$.operate.detailFull(\'' + row.thunderUnitId + '\')" style="margin-right: 5px"><i class="fa fa-search"></i>详细</a>');
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.thunderUnitId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.thunderUnitId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]

            };
			// queryDeptTree();
            $.table.init(options);
        });
		/* 用户管理-部门 */
		function dept() {
			var url = ctx + "system/tJcFlzddwCount";
			createMenuItem(url, "地区管理");
		}
		function queryDeptTree()
		{
			var url = ctx + "system/tJcFlzddwCount/treeData";
			var options = {
				url: url,
				view: {
					selectedMulti: true,      // 设置是否允许同时选中多个节点
					nameIsHTML: true           // 设置 name 属性是否支持 HTML 脚本
				},
				check: {
					enable: true,             // 置 zTree 的节点上是否显示 checkbox / radio
					nocheckInherit: true,      // 设置子节点是否自动继承
				},
				expandLevel: 2,
				onClick : zOnClick

			};
			$.tree.init(options);

			function zOnClick(event, treeId, treeNode) {
				$("#createId").val(treeNode.id);
				$("#prentId").val(treeNode.pId);
				$.table.search();
			}

		}
		$('#btnExpand').click(function() {
			$._tree.expandAll(true);
			$(this).hide();
			$('#btnCollapse').show();
		});

		$('#btnCollapse').click(function() {
			$._tree.expandAll(false);
			$(this).hide();
			$('#btnExpand').show();
		});
		$('#btnRefresh').click(function() {
			queryDeptTree();
		});
    </script>
</body>
<script id="importTpl" type="text/template">
	<form enctype="multipart/form-data" class="mt20 mb10">
		<div class="col-xs-offset-1">
			<input type="file" id="file" name="file"/>
			<div class="mt10 pt5">
				<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
				&nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
			</div>
			<font color="red" class="pull-left mt10">
				提示：仅允许导入“xls”或“xlsx”格式文件！
			</font>
		</div>
	</form>
</script>
</html>